export function formateDate(date: Date, rule: string) {
  let fmt = rule || 'yyyy-MM-dd hh:mm:ss'
  if (/(y+)/.test(fmt)) {
    fmt = fmt.replace(/(y+)/, date.getFullYear().toString())
  }
  const o = {
    // 'y+': date.getFullYear(),
    'M+': date.getMonth() + 1,
    'd+': date.getDate(),
    'h+': date.getHours(),
    'm+': date.getMinutes(),
    's+': date.getSeconds()
  }
  for (let k in o) {
    let reg = new RegExp(`${k}`)
    if (reg.test(fmt)) {
      const val = o[k] + ''
      fmt = fmt.replace(reg, ('00' + val).substring(val.length))
    }
  }
  return fmt
}